package com.example.demo.hadoop.reduce.controller;

import com.ctc.wstx.util.StringUtil;
import com.example.demo.hadoop.reduce.service.MapReduceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hadoop/reduce")
public class MapReduceController {
    @Autowired
    MapReduceService mapReduceService;

    @RequestMapping("wordCount")
    public String wordCount(String jobName, String inputPath) throws Exception {
        if (StringUtils.isEmpty(jobName) || StringUtils.isEmpty(inputPath)) {
            return "请求参数错误";
        }
        mapReduceService.wordCount(jobName, inputPath);
        return "统计成功";
    }


}
